import { defineStore } from "pinia"

export const useUserStore = defineStore("user", {
  state: () => {
    return {
      name: ["zyy"],
      age: 22,
      map:{}
    }
  },
  getters: {},
  actions: {
    addUser(val) {
      this.name.push(val)
    },
  },
  persist: {
    enabled: true,
    strategies: [
      {
        storage: localStorage, //表示存储在localStorage
        paths: ["age"], //表示持久化的字段
      },
    ],
  },
})
